﻿<%@ page language="java" import="java.util.*,org.yoao.crm.bean.StaticBean" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String url = request.getRequestURI();
String base = url.substring(1);
base = base.substring(0,base.indexOf("/"));
Map map = (Map)request.getAttribute("CONFIGMAP");
if(map == null) map = new HashMap();
String jndiName = (String)map.get(StaticBean.JNDINAME);
String pageSize = (String)map.get(StaticBean.PAGESIZE);
String isShowOldCustomer = (String)map.get(StaticBean.ISSHOWOLDCUSTOMER);
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html  xmlns:TW>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Expires" CONTENT="0">
<meta http-equiv="Cache-Control" CONTENT="no-cache, must-revalidate">
<meta http-equiv="Pragma" CONTENT="no-cache">
<title>CRM-系统配置</title>
<jsp:include page="../public/publicJs.jsp" flush="false"></jsp:include>
<link href="<%=basePath%>css/style2.css" rel="stylesheet" type="text/css">
<style >.tab_table_title tr{height:30}</style>
<script language="javascript">
 function getCheckBox(box, type){
 	var value = "";
 	if(box != null){
 		for(var i=0;i<box.length;i++ ){
			if(box[i].checked){
				if("label"==type)
					value += box[i].nextSibling.nodeValue+",";
				else if("value"==type)
					value += box[i].value+",";
			}
		}
		if(value.lastIndexOf(",") == (value.length-1)) value = value.substring(0, value.length-1);
	}
	return value;
 }

function initLoad(){
	document.getElementById("span_init_info").innerHTML = "<img src='<%=basePath%>images/loading.gif' class='icon1' alt='初始化' align='absmiddle'/><font color='#FF0000'>初始化中,请稍后...</font>";
}
function initSystem(){
 	var url = "<%=basePath%>config.crm?method=database&type=" + getCheckBox(document.all.initType, "value");
	document.getElementById("span_init_info").innerHTML = "<img src='<%=basePath%>images/info.gif'  class='icon1' alt='初始化' align='absmiddle'/><font color='#FF0000'>"+ajax_getReturnText(url)+"</font>";
}
function saveConfig(){
	var url = "<%=basePath%>config.crm?method=saveConfig" +
			  "&<%=StaticBean.JNDINAME%>="+document.all.<%=StaticBean.JNDINAME%>.value +
			  "&<%=StaticBean.PAGESIZE%>="+document.all.<%=StaticBean.PAGESIZE%>.value +
			  "&<%=StaticBean.ISSHOWOLDCUSTOMER%>=" + getCheckBox(document.all.<%=StaticBean.ISSHOWOLDCUSTOMER%>, "value");
	document.getElementById("span_init_info").innerHTML = "<img src='<%=basePath%>images/info.gif' class='icon1' alt='初始化' align='absmiddle'/><font color='#FF0000'>"+ajax_getReturnText(url)+"</font>";
}
</script>
</head>
<body>
<form id="form1" name="form1" action="" method="POST">
<table class="title_top" width=100% align=center cellspacing=0 border="0" cellspacing="0" cellpadding="0" style="border:0px">
	<tr valign="top" class="tree_title_txt">
		<td class="tree_title_txt"  height=26 align=center	valign="middle">系统配置</td>
	</tr>
	<tr valign="top" height="100%">
	 <td align=center>
	    <table align=center width=96%  border="0" cellspacing="0" cellpadding="0" style="margin-top:12px">
		<tr valign="top">
		<td width="100%">
		 <table border="0" cellspacing="0" cellpadding="0">
		 <tr valign="top">
		 	<td id="Form_tab_0" class="Form_tab" width=70 align=center onClick="chgTabN()"  valign="middle">基本设置</td>
		 	<td id="Form_tab_1" class="Form_tab" width=70 align=center onClick="chgTabN()"  valign="middle" style="display:none">待定义</td>
			<td id="Form_tab_2" class="Form_tab" width=70 align=center onClick="chgTabN()"  valign="middle" style="display:none">待定义</td>
		 </tr>
		 </table>
		 <script>ShowTabN(0);</script>
	 </td>
	</tr>
	<tr valign="top"><td class="tab_subline" width="100%" height="2"></td></tr>
	 <tr><td width=100%>
  <div class="tabBody" style="height:expression(document.body.offsetHeight-104);background:#ffffff;overflow-y:auto;padding:12px;padding-top:0px">
  	 <div id="TD_tab_0" style="width:90%">
  	 	<fieldset style="width:98%" align="center">
			<legend>参数配置<img border="0" src="<%=basePath%>images/jt_b.gif" onClick="fieldsetHidden()" style="cursor:hand" title="显示/隐藏内容">&nbsp; </legend>
			<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:12px">
				<tr>
					<td align="left" width="15%">&nbsp;JNDI参数:</td>
					<td align="left"><input name="<%=StaticBean.JNDINAME%>" type="text" class="text_220" style="width:150px" value="<%=jndiName!=null?jndiName:""%>"></td>
				</tr>
				<tr>
					<td align="left">&nbsp;单页显示记录数:</td>
					<td align="left"><input name="<%=StaticBean.PAGESIZE%>" type="text" class="text_220" style="width:150px" value="<%=pageSize!=null?pageSize:""%>"></td>
				</tr>
				<tr>
					<td align="left" colspan="2">
						<input type="checkbox" name="<%=StaticBean.ISSHOWOLDCUSTOMER%>" value="1" <%if("1".equals(isShowOldCustomer)){%>checked<%}%>>启用客户旧信息
						<input type="checkbox" name="<%=StaticBean.ISSHOWOLDCUSTOMER%>" value="0" style="display:none">
					</td>
				</tr>
				<tr>
					<td align="right" style="padding-right:12px" colspan="2">
						<input type="button" name="btn_init" class="btn3_mouseout" value="保存" onMouseDown="initLoad()" onClick="saveConfig()">
					</td>
				</tr>
			</table>
			<span style="text-align:left;width:100%;"></span>
		</fieldset>
	  	<fieldset style="width:98%;display:none" align="center">
			<legend>系统初始化<img border="0" src="<%=basePath%>images/jt_b.gif" onClick="fieldsetHidden()" style="cursor:hand" title="显示/隐藏内容">&nbsp; </legend>
			<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-top:12px">
				<tr><td align="left">
				<font color="#008080">【说明】系统安装后第一次运行时，请先初始化数据库，以确保数据库正常运行。</font>
				</td></tr>
				<tr><td align="left"><input name="initType" type="checkbox" value="DataBase">数据库</td></tr>
				<tr style="display:none"><td align="left"><input name="initType" type="checkbox" value=""></td></tr>
				<tr><td align="right" style="padding-right:12px"><input type="button" name="btn_init" class="btn3_mouseout" value="开始" onMouseDown="initLoad()" onClick="initSystem()"></td></tr>
			</table>
			<span style="text-align:left;width:100%;"></span>
		</fieldset>
	</div>

	 <div id="TD_tab_1" style="display:none">
	 </div>

	<div id="TD_tab_2" style="display:none">
	</div>
	</BR>
	<span id="span_init_info" style="text-align:left;width:100%;"></span>
  </div>
</td></tr></table>
</td></tr></table>
</form>
</body>
</html>